<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2023/5/12
 * Time: 15:30
 */

namespace App\Rep;


use App\Models\OrderFieldLog;

class OrderFieldLogRep
{

//    public function addOrderFieldLogRep($params){
//        if(isset($params['id']) && !empty($params['id'])){
//            $model = OrderFieldLog::where('id',$params['id'])->first();
//            $model->color = $params['color'];
//            $model->save();
//        }else{
//            if (strpos($params['color'], ',') !== false) {
//                //批量添加
//                $color_list = explode(',',$params['color']);
//                foreach($color_list as $k=>$v){
//                    OrderFieldLog::updateOrCreate(['color'=>$v],['color'=>$v]);
//                }
//            } else {
//                //单个添加
//                OrderFieldLog::updateOrCreate(['color'=>$params['color']],['color'=>$params['color']]);
//            }
//        }
//
//
//        return ['code'=>0,'data'=>[],'msg'=>'success'];
//    }

    //获取列表
    public function getOrderFieldLogListRep($params){
        $list = OrderFieldLog::where('order_type',$params['order_type'])
            ->where('is_del',2)
            ->get();
        return $list;
    }

    public function setOrderFieldLogRep($params){
        OrderFieldLog::where('order_type',$params['order_type'])->update(['is_show'=>2]);
        OrderFieldLog::whereIn('id',$params['ids'])->update(['is_show'=>1]);
    }



}